package gui;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;

/**
 * @author Ramy Refky 
 * */
public class NandComponentLabel extends ComponentLabel{

	private static final long serialVersionUID = 1L;
	
	/**
	 * Constructor initializes ComponentLabel.
	 * @param XLocation, YLocation, Width, Height
	 */
	public NandComponentLabel(int xLoc,int yLoc,int originalWidth, int originalHeight){
		super(xLoc,yLoc,originalWidth,originalHeight);
	}
	/**
	 * Paints the NAND gate graphics.
	 */
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);

		Rectangle Box = new Rectangle();
		Box.setBounds(newWidth/6+2,2,newWidth/3,newHeight-4);
		Shape arc = new Arc2D.Float(newWidth/6+6,2,newWidth*2/3-8,newHeight-4,-90,180, Arc2D.PIE);
		
    	Graphics2D g2 = (Graphics2D)g;
    	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                             RenderingHints.VALUE_ANTIALIAS_ON);
    	
        g2.setStroke(new BasicStroke(2f));
        g2.setPaint(Color.black);
        g2.draw(Box);
        g2.draw(arc);
        
        if(!selected)
        	g2.setPaint(Color.white);
        else
        	g2.setPaint(Color.getHSBColor((float)0.5,(float)0.1,(float)0.9));
        Box.setBounds(newWidth/6+3,3,newWidth/3,newHeight-5);
        Shape arc2 = new Arc2D.Float(newWidth/6+6,3,newWidth*2/3-8,newHeight-5,-90,180, Arc2D.PIE);
	    
        g2.fill(Box);
        g2.fill(arc2);
       
        Shape circle = new Ellipse2D.Float((float) (newWidth*2.4/3),(float) ((float) (newHeight/2)-3.5),7,7);
        g2.fill(circle);
        g2.setPaint(Color.black);
        g2.draw(circle);
	}	
}